/**
 * <copyright>
 * </copyright>
 *
 * $Id: UsecaseModelImpl.java 483 2007-04-03 03:07:06Z petterei $
 */
package biz.modelx.precise.usecase.ui.model.eusecase.impl;

import biz.modelx.precise.ui.model.eprecise.impl.PPersistableImpl;

import biz.modelx.precise.usecase.ui.model.eusecase.Actor;
import biz.modelx.precise.usecase.ui.model.eusecase.EusecasePackage;
import biz.modelx.precise.usecase.ui.model.eusecase.SystemBoundery;
import biz.modelx.precise.usecase.ui.model.eusecase.Usecase;
import biz.modelx.precise.usecase.ui.model.eusecase.UsecaseModel;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Usecase Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link biz.modelx.precise.usecase.ui.model.eusecase.impl.UsecaseModelImpl#getSusecases <em>Susecases</em>}</li>
 *   <li>{@link biz.modelx.precise.usecase.ui.model.eusecase.impl.UsecaseModelImpl#getSactors <em>Sactors</em>}</li>
 *   <li>{@link biz.modelx.precise.usecase.ui.model.eusecase.impl.UsecaseModelImpl#getBoundaries <em>Boundaries</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class UsecaseModelImpl extends PPersistableImpl implements UsecaseModel {
	/**
	 * The cached value of the '{@link #getSusecases() <em>Susecases</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSusecases()
	 * @generated
	 * @ordered
	 */
	protected EList<Usecase> susecases;

	/**
	 * The cached value of the '{@link #getSactors() <em>Sactors</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSactors()
	 * @generated
	 * @ordered
	 */
	protected EList<Actor> sactors;

	/**
	 * The cached value of the '{@link #getBoundaries() <em>Boundaries</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBoundaries()
	 * @generated
	 * @ordered
	 */
	protected EList<SystemBoundery> boundaries;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected UsecaseModelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return EusecasePackage.Literals.USECASE_MODEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Usecase> getSusecases() {
		if (susecases == null) {
			susecases = new EObjectContainmentEList<Usecase>(Usecase.class, this, EusecasePackage.USECASE_MODEL__SUSECASES);
		}
		return susecases;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Actor> getSactors() {
		if (sactors == null) {
			sactors = new EObjectContainmentEList<Actor>(Actor.class, this, EusecasePackage.USECASE_MODEL__SACTORS);
		}
		return sactors;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SystemBoundery> getBoundaries() {
		if (boundaries == null) {
			boundaries = new EObjectContainmentEList<SystemBoundery>(SystemBoundery.class, this, EusecasePackage.USECASE_MODEL__BOUNDARIES);
		}
		return boundaries;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case EusecasePackage.USECASE_MODEL__SUSECASES:
				return ((InternalEList<?>)getSusecases()).basicRemove(otherEnd, msgs);
			case EusecasePackage.USECASE_MODEL__SACTORS:
				return ((InternalEList<?>)getSactors()).basicRemove(otherEnd, msgs);
			case EusecasePackage.USECASE_MODEL__BOUNDARIES:
				return ((InternalEList<?>)getBoundaries()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case EusecasePackage.USECASE_MODEL__SUSECASES:
				return getSusecases();
			case EusecasePackage.USECASE_MODEL__SACTORS:
				return getSactors();
			case EusecasePackage.USECASE_MODEL__BOUNDARIES:
				return getBoundaries();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case EusecasePackage.USECASE_MODEL__SUSECASES:
				getSusecases().clear();
				getSusecases().addAll((Collection<? extends Usecase>)newValue);
				return;
			case EusecasePackage.USECASE_MODEL__SACTORS:
				getSactors().clear();
				getSactors().addAll((Collection<? extends Actor>)newValue);
				return;
			case EusecasePackage.USECASE_MODEL__BOUNDARIES:
				getBoundaries().clear();
				getBoundaries().addAll((Collection<? extends SystemBoundery>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case EusecasePackage.USECASE_MODEL__SUSECASES:
				getSusecases().clear();
				return;
			case EusecasePackage.USECASE_MODEL__SACTORS:
				getSactors().clear();
				return;
			case EusecasePackage.USECASE_MODEL__BOUNDARIES:
				getBoundaries().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case EusecasePackage.USECASE_MODEL__SUSECASES:
				return susecases != null && !susecases.isEmpty();
			case EusecasePackage.USECASE_MODEL__SACTORS:
				return sactors != null && !sactors.isEmpty();
			case EusecasePackage.USECASE_MODEL__BOUNDARIES:
				return boundaries != null && !boundaries.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //UsecaseModelImpl
